//
//  UIColor+category.swift
//  swift-GWYWeiBo
//
//  Created by x on 2017/6/27.
//  Copyright © 2017年 HLB. All rights reserved.
//

import UIKit

extension UIColor {
    
    /// 生成一个随机颜色
    ///
    /// - Returns: <#return value description#>
    class func randomColor() -> UIColor {
        return UIColor(red: randomNumber(), green: randomNumber(), blue: randomNumber(), alpha: 1.0)
    }
    
    /// 产生一个随机数
    ///
    /// - Returns: <#return value description#>
    class func randomNumber() -> CGFloat {
        return CGFloat(arc4random_uniform(256))/CGFloat(255.0)
    }
    
    /// 产生一个RGB颜色
    ///
    /// - Parameters:
    ///   - r: <#r description#>
    ///   - g: <#g description#>
    ///   - b: <#b description#>
    /// - Returns: <#return value description#>
    class func RGBColor(r:CGFloat, g:CGFloat, b:CGFloat) -> UIColor {
        return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: 1.0)
    }
}
